﻿package code {
	// triange shape class
	public class Triangle extends BaseShape{
		private var triHeight:int;  // height of the triangle
		private var thirdVertex:Vertex; // third vertex of the triangle
		
		public function Triangle(radius:Number, sides:Number, color:uint, thickness:Number, hollow:Boolean, angle:Number, triHeight:int, thirdVertex:Vertex) {
			super(radius, sides, color, thickness, hollow, angle)
			this.triHeight = triHeight;
			this.thirdVertex = thirdVertex;
			init();
		}
		
		private function init(){
			makeVertices();  // makes the vertices
			rotateVertices();  // rotates them by the angle wanted
			renderVertices();  //renders the screen
		}
		
		// makes vertices
		override public function makeVertices():void{
			var vert1 = new Vertex(x, y);  // creates first vert at x,y
			var vert2 = new Vertex(x + radius, y + triHeight);  // creates second at the radius and height

			var vert3 = thirdVertex;  // just assigns the third vertex
			
			vertices.push(vert1, vert2, vert3);
		}

	}
	
}
